package proxy.general;

/**
 * @Author：LJ
 * @Description：虚拟代理
 * @Date: 2017/11/27
 * @Modified By:
 */
public class VirtualProxy implements Subject {
    private Subject subject;

    @Override
    public void doSomething() {
        if (subject == null)//被代理者是否存在,避免被代理对象较多引起的初始化缓慢的问题
            subject = new RealSubject();
        subject.doSomething();
    }
}
